Learning Belief Distributions for Game Moves

ABSTRACT

We describe an apparatus for learning to predict moves in games such as chess, Go and the like, from historical game records. We obtain a probability distribution over legal moves in a given board configuration. This enables us to provide an automated game playing system, a training tool for players and a move selector/sorter for input to a game tree search system. We use a pattern extraction system to select patterns from historical game records. Our learning algorithm learns a distribution over the values of a move given a board position based on local pattern context. In another embodiment we use an Independent Bernoulli model whereby we assume each moved is played independently of other available moves.

TECHNICAL FIELD

This description relates generally to automated systems for playing board games involving two players. It is particularly related to, but in no way limited to automated systems for playing games such as GO, Chess and the like which use probabilistic models.

BACKGROUND

Previous attempts have been made to program computers to play Go. However, performance has not matched the level of chess programs with even the strongest programs having the ability of an average club player. The best Go programs play only at the level of weak amateur Go players and Go is therefore considered to be a serious Al (artificial intelligence) challenge not unlike Chess in the 1960s. There are two main reasons for this state of affairs: firstly, the high branching factor of Go (typically 200 to 300 potential moves per position) prevents the expansion of a game tree to any useful depth. Secondly, it is difficult to produce an evaluation function for Go positions. A Go stone has no intrinsic value; its value is determined by its relationships with other stones. Go players evaluate positions using visual pattern recognition and qualitative intuitions which are difficult to formalize.

SUMMARY

The following presents a simplified summary of the disclosure in order to provide a basic understanding to the reader. This summary is not an extensive overview of the disclosure and it does not identify key/critical elements of the invention or delineate the scope of the invention. Its sole purpose is to present some concepts disclosed herein in a simplified form as a prelude to the more detailed description that is presented later.

We describe an apparatus for learning to predict moves in games such as chess, Go and the like, from historical game records. We obtain a probability distribution over legal moves in a given board configuration. This enables us to provide an automated game playing system, a training tool for players and a move selector/sorter for input to a game tree search system. We use a pattern extraction system to select patterns from historical game records. Our learning algorithm learns a distribution over the values of a move given a board position based on local pattern context. In another embodiment we use an Independent Bernoulli model whereby we assume each move is played independently of other available moves.

In an example we describe a method of learning probability information for each of a plurality of patterns, each pattern corresponding to a move in a game. Historical game records comprising sequences of moves are used. From those one or more patterns are extracted for each move. Some of the extracted patterns are selected and others discarded in a harvesting process which enables us to achieve generalization. In one example, for each of the selected patterns our system determines patterns corresponding to alternative moves which could have been played. Probability information is learnt for each of the selected patterns on the basis of at least information about the patterns corresponding to alternative moves which could have been played. In some embodiments Bayesian inference is used to learn a probability distribution over legal moves in a given board configuration. In other embodiments, an Independent Bernoulli model is used.

The methods described herein may be performed by software in machine readable form on a storage medium. The software can be suitable for execution on a parallel processor or a serial processor such that the method steps may be carried out in any suitable order, or simultaneously.

This acknowledges that software can be a valuable, separately tradable commodity. It is intended to encompass software, which runs on or controls “dumb” or standard hardware, to carry out the desired functions, (and therefore the software essentially defines the functions of the register, and can therefore be termed a register, even before it is combined with its standard hardware). For similar reasons, it is also intended to encompass software which “describes” or defines the configuration of hardware, such as HDL (hardware description language) software, as is used for designing silicon chips, or for configuring universal programmable chips, to carry out desired functions.

The term ‘computer’ is used herein to refer to any device with processing capability such that it can execute instructions. Those skilled in the art will realize that such processing capabilities are incorporated into many different devices and therefore the term ‘computer’ includes PCs, servers, mobile telephones, personal digital assistants, games consoles and many other devices

Many of the attendant features will be more readily appreciated as the same becomes better understood by reference to the following detailed description considered in connection with the accompanying drawings.

DESCRIPTION OF THE DRAWINGS

The present description will be better understood from the following detailed description read in light of the accompanying drawings, wherein:

FIG. 1 shows part of a GO board with two chains of white stones and one chain of black stones;

FIG. 2 a shows part of a GO board with a chain of black stones;

FIG. 2 b shows the part of the GO board of FIG. 2 a after capture of the black stones;

FIG. 3 shows as example of a set of 14 pattern templates;

FIG. 4 shows part of a Go board with pattern template T11 centered about grid point 2-4;

FIG. 5 is an example factor graph for three potential game moves, one of which is chosen by a player, the factor graph represents a ranking model;

FIG. 6 shows the factor graph of FIG. 5 with arrows indicating scheduling;

FIG. 7 is a flow diagram of a method of learning urgencies of pattern classes;

FIG. 8 is a flow diagram of an automated method of playing a game using urgencies of pattern classes;

FIG. 9 is a flow diagram of a method of learning probabilities of being played for pattern classes;

FIG. 10 is a schematic diagram of a game engine as part of a system for playing a game;

FIGS. 11 to 15 are example factor graphs.

Like reference numerals are used to designate like parts in the accompanying drawings.

DETAILED DESCRIPTION

The detailed description provided below in connection with the appended drawings is intended as a description of the present examples and is not intended to represent the only forms in which the present example may be constructed or utilized. The description sets forth the functions of the example and the sequence of steps for constructing and operating the example. However, the same or equivalent functions and sequences may be accomplished by different examples.

We recognize that the complexity of GO, and other games such as Chess and the like, results in uncertainty about the future course and outcome of the game. We aim to model this uncertainty using probability. For example, we focus on the task of predicting moves made by expert Go players. In some embodiments we seek to obtain a probability distribution over legal moves from a given board configuration. In other embodiments we assume that the probability of a given move is independent of other possible moves in a given board configuration.

The Game of Go

The game of Go originated in China over 4000 years ago. Its rules are straightforward. Two players, Black and White, take turns to place stones on the intersections of an N×N grid (usually N=19 but smaller boards are in use as well). All the stones of each player are identical. Players place their stones in order to create territory by occupying or surrounding areas of the board. The player with the most territory at the end of the game is the winner. A stone is captured if it has been completely surrounded (in the horizontal and vertical directions) by stones or the opponent's color.

For example, FIG. 1 shows part of a Go board. The players take turns to place a stone on a grid intersection or point. Empty adjacent points to a store are referred to as liberties. Thus in FIG. 1 small black dots A are used to show the liberties of the black stones. Small white circles B are used to show the liberties of the white stones. FIG. 1 shows two chains of white stones 10, 11 and one chain of black stones 12. Stones in a chain share their liberties. When a stone or a chain of stones is surrounded by opponent stones it has no liberties and is therefore captured and removed from the board. For example FIG. 2 a shows a region of a Go board. If white plays at A in that situation, then the black chain loses its last liberty. The black chain is then captured and removed from the board as illustrated in FIG. 2 b. A player may pass instead of placing a stone. The game ends when both players pass consecutively. The game is then scored with the highest scoring player being the winner. For example, according to Japanese rules a player's score is the number of empty points enclosed by his or her stones plus the number of points occupied by his or her stones. Full details of the rules of Go are not given here because they are widely publicly available, for example, in “The Game of Go”, Matthew Macfadyen, 1998 Carlton Books Limited, ISBN 1858684919. Despite the fact that the rules are simple the resulting game play is very complex and interesting. For example, to cover the largest area one needs to spread out but to secure an area of the board it is good to play stones close together. Also, to try to cover a large area, expansionist play is needed but this potentially leaves weaknesses that can be exploited by the opponent. If a player places stones far from the edge of the board the opponent has space to invade but placing stones close to the edge gives reduced territory and influence.

Patterns, Pattern Templates and Pattern Classes

We define a pattern as an exact arrangement of stones (or other playing pieces) within a sub-region of a board (or other defined playing space comprising a grid), centered on an empty location where a move is to be made. The possible sub-regions are preferably specified as pattern templates as described below. By focusing on exact local patterns for move prediction we achieve advantages. We are able to match patterns very efficiently because of their local range and because the matching procedure does not have to take into account wildcards, i.e., parts of the patterns that match to more than one possible value. As a result we can train our system on a very large number of games without requiring impractical processing capacity and time. Also, we can generate moves for play very quickly because we are able to match the patterns very efficiently.

In a preferred embodiment, the pattern templates are a nested sequence of increasing size so as to be able to use large patterns with greater predictive power when possible, but to be able to match smaller patterns when necessary. FIG. 3 shows an example of a sequence of 14 nested pattern templates. In this example, template 1 comprises the square labeled 1, template 2 comprises the squares labeled either 1 or 2, template 3 comprises the squares labeled 1, or 2 or 3 and so on. Template 14 comprises all the squares including those extending beyond the plot as indicated by “+”. FIG. 4 shows part of a board configuration from an expert game. Pattern template T11 is shown centered about the grid point marked with a cross in that FIG. 4.

We automatically generate and learn from the patterns in two distinct processes. Firstly we harvest sufficiently frequent patterns from historical game records and then we learn from those patterns. The historical game records are preferably taken from games involving expert players although this is not essential. In one group of embodiments we learn urgencies for the patterns (or pattern classes as explained later) using a ranking model. In another group of embodiments we learn an estimate of a play probability (probability of being played) for each pattern or pattern class. Both groups of embodiments use types of Bayesian inference. Each board configuration contains a subset of the harvested move-patterns of which the player in the historical record chooses one. In the urgency embodiment, this information indicates that the chosen move-pattern has a higher urgency than that of the other possible patterns. In the play probability embodiments if an available move is observed as played its probability estimate is increased and if it is observed as not being played its probability estimate is decreased. It is this information together with the fact that typical move-patterns occur in more than one position that allows the system to generalize across specific board configurations.

In some embodiments we advantageously group patterns into pattern classes in order to reduce computational complexity, storage requirements, computation time, required processing capacity and the like. However, it is not essential to use pattern classes. Computations can be carried out for each individual member of a pattern class.

We recognize that every pattern can occur in up to 16 different ways in the case of GO and in other multiples for other games depending on allowable board configurations etc. For example, in the case of GO, the 16 different ways can be thought of as the 8 different symmetries of a square (which can be rotated through 0, 90, 180 and 270 degrees for itself and for its mirror image) and each of these 8 different symmetries can occur for either black or white playing pieces (color reversal) giving 16 different options. A pattern class is then an exact arrangement of playing pieces within a sub-region of the board, centered on an empty location where a move is to be made, and all the other equivalent patterns occurring as a result of symmetries and/or color reversal.

Pattern Harvesting

In order to learn from a huge number of known Go board moves (or board moves of other games such as Chess and the like) from historical game records we are faced with a number of problems. The large number of board moves per game (e.g. 250) leads to problems when we need to learn from large numbers of games. These problems are associated with limits on processing capacity, storage capacity and the like. In addition, we require some degree of generalization in order to learn effectively.

That is, in systems which learn by example, if all historical examples are stored without generalization, it is difficult to deal with new instances that have not been observed before. Instead, it is preferred to make generalizations where possible such that new instances can be appropriately dealt with. In the present case we achieve this generalization in the case of games such as GO, Chess and other games involving configuration of playing pieces, by selecting less than the full set of pattern classes from historical game moves for use by a learning system. In the present application we refer to this selection process as pattern harvesting. We recognize that a particular problem with such pattern harvesting lies in deciding which patterns to harvest and which to ignore. One option is to randomly select, or select in some arbitrary manner, a specified proportion of historical patterns from game records. In another embodiment we select those patterns which occur multiple times in the complete set of historical game records. For example, in a preferred embodiment, we select any pattern which occurs more than once in the complete set of game records. However, it is also possible to select only those patters which occur 2 or more times: or 3 or more times and so on. This is based on the consideration that if a pattern is observed more than once in the training sample then it is likely to be observed (and hence useful) in new board configurations. Any suitable selection criteria can be used.

For example, we used a training set made up of 181,000 Go games, each game having about 250 moves. We used a set of 14 different pattern templates giving about 600 million patterns at our disposal (181,000×250×14=635,500,000). Of these we selected those patterns that appear as a move at least twice in the collection. This enabled us to retain about 2% (about 12 million) of the observed patterns and discard around 98% of those. However, these figures are examples only; other suitable sizes of collection and selection rates can be used.

With huge numbers (e.g. 600 million) of patterns at our disposal it is a difficult task to identify those patterns which occur at least twice in the collection. Even if enough memory is available to store the 600 million patterns there is an efficiency issue to go through this list to find patterns occurring at least twice. This problem is general in that it is not specific to GO moves or moves of other games. Any situation in which there are a large number of records from which it is required to select a sub-set on the basis of a non-trivial criterion is applicable.

In order to address this problem we use a Bloom filter approach. Bloom filters are described in Bloom, BH (1970) “Space/time trade-offs in hash coding with allowable errors”, Communications of the ACM, 13, 422-426. A Bloom filter can be used to test whether an element is a member of a set using a space-efficient probabilistic data structure. It is asymmetric in the sense that false positives are possible but false negatives are not. So in the case of selecting GO move patterns which occur twice or more, a false positive involves selecting a pattern in error when it actually occurs only once in the collection. A false negative involves rejecting a pattern which should have been selected. In our GO, and other game situations, we recognize that it is much more valuable to prevent false negatives than to prevent false positives and so Bloom filters are suitable in this respect. Because there are relatively few patterns which occur twice or more we prefer to retain all such patterns. Having said that, other embodiments in which selection methods do make false negatives can be used.

In an example we use a spectral Bloom filter which is an extension of the original Bloom filter to multi-sets, allowing the filtering of elements whose multiplicities are below a threshold given at query time. Spectral Bloom filters are described in “Spectral Bloom filters”, Saar Cohen, Yossi Matias, Proceedings of the 2003 ACM SIGMOD international conference on Management of Data, 241-252, 2003.

When a pattern is found in the historical game records then it is first tested if that pattern has been stored in the Bloom filter before. If it has, then the current occurrence must be at least the second time that the pattern is observed and we can add it to our collection (e.g., store it in a hash table). If it has not been previously stored in the Bloom filter, we store it and move on to the next pattern.

Board and Pattern Representation

We represent the Go board as a lattice ζ:={1 . . . N}² where N is the board size and is usually 9 or 19. In order to represent patterns that extend across the edge of the board in a unified way, we expand the board lattice to include the off-board areas. The extended board lattice is {circumflex over (ζ)}:={{right arrow over (υ)}+{right arrow over (Δ)}: {right arrow over (υ)} ε ζ, {right arrow over (Δ)} ε D} where the offset vectors are given by D:={−(N-1), . . . , (N-1)}² and we will use the notation {right arrow over (υ)}:=(υ_(x),υ_(y)) to represent 2-dimensional vertex vectors. We define a set of “colors” C: {b,w,e,o} (black, white, empty, off). Then a board configuration is given by a coloring function c: {circumflex over (ζ)}→C and we fix the position for off-board vertices ∀{right arrow over (υ)}ε{right arrow over (ζ)}\ζ: c({right arrow over (υ)})=o.

Our analysis is based on a fixed set T of pattern templates T⊂T on which we define a set Π of patterns π: T→C that are used to represent moves made in a given local context. The patterns preferably have the following properties:

-   -   The pattern templates T are rotation and mirror symmetric with         respect to their origin, i.e. we have that (υ_(x),υ_(y))εT         (−υ_(y),−v_(x))εT and (υ_(y),−υ_(x))εT, thus displaying an         8-fold symmetry.     -   Any two pattern templates T,T′εT satisfy that either T⊂T′ or         T′⊂T. For convenience, we index the templates T ε T with the         convention that i<j implies T_(i)⊂T_(j), resulting in a nested         sequence (see FIG. 3).     -   We have π({right arrow over (0)})=c for all patterns because for         each pattern to represent a legal move the centre point must be         empty.     -   The set of patterns Π is closed under rotation, mirroring and         color reversal, i.e. if π ε Π and π′ is such that it can be         generated from π by any of these transformations then π′εΠ. In         this case, π and π are considered equivalent, π˜π′, and we         define a set {tilde over (Π)} of equivalence classes {tilde over         (π)}⊂Π.

Note that {tilde over (Π)} is a partition of Π and thus mutually exclusive, ∩_({tilde over (π)}ε{tilde over (Π)}){tilde over (π)}=θ, and exhaustive,

${\bigcup_{\overset{\sim}{\pi} \in \overset{\sim}{\Pi}}\overset{\sim}{\pi}} = {\Pi.}$

We say that a pattern π ε Π matches configuration c at vertex {right arrow over (υ)} if for all {right arrow over (Δ)} εT(π) we have c({right arrow over (υ)}+{right arrow over (Δ)})=π({right arrow over (Δ)}). Note that T(π) is the template for the pattern π. We say that pattern class {tilde over (π)} ε {tilde over (Π)} matches configuration c at vertex {right arrow over (υ)} if one of its constituent patterns π ε {tilde over (π)} matches c at {right arrow over (υ)}.

Local Features

In order to extend the predictive power of the smaller patterns and hence improve generalization we optionally incorporate one or more additional features into each pattern. For example, one or more of the following local features of a move can optionally be used:

Liberties of new chain (2 bits). The number of liberties of the chain of stones we produce by making the move. In a preferred embodiment we limit the values of this local features to being any of {1, 2, 3, >3}. However, this is not essential, any suitable values for this local feature can be used. The number of ‘liberties’ of a chain of stones is the lower bound on the number of opponent moves needed to capture the chain.

Liberties of opponent (2 bits). The number of liberties of the closest opponent chain after making the move. Values are preferably, but not essentially any of {1, 2, 3, >3}.

Ko (1 bit). Is there an active Ko on the board? A ‘Ko’ is a move which is illegal because it would cause an earlier board position to be repeated.

Escapes atari (1 bit). Does this move bring a chain out of Atari? A chain is in ‘atari’ if it can be captured immediately.

Distance to edge (2 bits). Distance of move to the board edge. Values are preferably but not essentially selected from {<3, 4, 5, >5}.

We define the set of labels of these features as F=(1, . . . , 8). Given a move {right arrow over (υ)} in position c the function ƒ_(c): F×ζ→{1,0} maps each feature to its binary true/false value. It is worth noting that for the larger patterns these features are already seen in the arrangement of stones within the template region so the larger patterns are less likely to be altered by the addition of these features.

Pattern Matching and Storing

In a preferred embodiment we do not use an explicit representation of the patterns but define a hash key for patterns and store their properties in a hash table. However, it is not essential to do this. The pattern properties can be stored in any suitable manner or alternatively the patterns themselves can be stored together with their properties. In the hash key example, we advantageously adapt a Zobrist hashing method (Zobrist, A. 1990 “A new hashing method with applications for game playing”. ICCA Journal, 13, 69-73), which has the advantage that it can be updated incrementally. For example, we generate four sets of 64 bit random numbers, h_(a): {tilde over (ζ)}→{0, . . . 2⁶⁴−1}a ε C, four for each vertex in the extended Go lattice {tilde over (ζ)}. We also generate a random number for each of the local features l: F→{0, . . . , 2⁶⁴−1}. The hash-key k(π,{right arrow over (υ)}, c) of a given pattern π at vertex {right arrow over (υ)} in board configuration c can be calculated by XORing together the corresponding random numbers,

k(π,{right arrow over (υ)},c):=_(π) ⊕ k _({right arrow over (υ)},c),

Where,

${k_{\pi}:={\begin{matrix}  \oplus \\ {\overset{\rightarrow}{\Delta} \in {T(\pi)}} \end{matrix}{h_{\pi}\left( \overset{\rightarrow}{\Delta} \right)}}},{k_{\overset{\rightarrow}{v},c}:={\begin{matrix}  \oplus \\ {i \in F} \end{matrix}{l(i)}{{f_{c}\left( {i,\overset{\rightarrow}{v}} \right)}.}}}$

Both adding a stone and removing a stone of color a ε {b,w} at position {right arrow over (Δ)} correspond to the same operation k_(π←k) _(π) ⊕ h_(a). Due to the commutativity of XOR the hash-key can be calculated incrementally as stones are added or removed from a pattern. However, we prefer to store the pattern classes {tilde over (π)} instead of single patterns π to take account of the relevant symmetries. This is achieved by choosing {tilde over (k)}_(π):=min_(πε{tilde over (π)}k) _(π), i.e. by calculating the hash-key for every symmetry variant of the pattern and choosing the minimum of those hash-keys. (It is not essential to choose the minimum; any particular one of the hash-keys can be selected e.g. the maximum, as long as a consistent selection method is used in creation of the hash table.) The resulting hash-table allows us to store and retrieve information associated with each pattern without an explicit representation of the pattern itself. This could be the game-record the move was found in or relevant statistics, such as the percentage of games won after playing that move.

Pattern Harvesting

A particular example of pattern harvesting is now described in detail.

From a database of Go game records we harvest pattern classes {tilde over (π)} corresponding to moves made by expert players. We let the computer play through each of the games in the collection and maintain a |T|×|{circumflex over (ζ)}|-table H of hash-keys corresponding to each of the pattern templates T_(i) at each of the vertices {right arrow over (υ)} ε {circumflex over (ζ)}. The update after each move makes sure that if pattern class {tilde over (π)} matches the resulting configuration c at vertex {right arrow over (v)} then H_(a,{right arrow over (v)})={tilde over (k)}({tilde over (π)}). Whenever an entry in H changes, the new hash-key can be used to mark that pattern as being present in the collection.

A rough estimate shows that for 181,000 games records with an average length of 250 moves and |T|=14 different pattern templates we have about 600 million patterns at our disposal. To limit storage requirements and to ensure generalization to as yet unseen positions we only want to include in Π those patterns that appear as a move made by an expert twice in the collection. We use a Bloom filter (Bloom, 1970) B to mark of patterns that have been seen at least once. For every pattern we observe we use B to check if it is new; if it is, we add it to B. if B indicates that the pattern has been seen before we increment the count in our pattern hash-table D_({tilde over (Π)}) that represents {tilde over (π)}.

Learning from the Harvested Patterns or Harvested Pattern Classes

Once the patterns have been harvested we carry out a learning process to either learn an urgency value for each pattern class, or to learn a play probability for each pattern class. It is also possible to learn these factors for individual patterns as opposed to pattern classes.

The term “urgency” is used herein to refer to a latent variable, not directly observable, which provides an indication of the quality (or goodness) of playing a move (or pattern class).

In the case that we learn an urgency value for each pattern class a method of learning is now described with reference to FIG. 7. We use a probability distribution (such as a Gaussian or other distribution) to represent our belief about the urgency value of a particular pattern class. In a preferred embodiment we use a Gaussian belief distribution which is uniquely described by its mean and standard deviation. The area under a Gaussian belief distribution within a certain range corresponds to the belief that the urgency value will lie in that range. As the system learns more from the game records, the standard deviation has the tendency to become smaller, more tightly bracketing the urgency for the pattern class. Another way of thinking about the mean and standard deviation values is to consider them as the “average belief in the quality of a move or pattern class” and “the uncertainty” associated with the assessment of that quality, respectively.

In FIG. 7 an example of our method for determining an indication of an urgency of a move (or pattern class) given a particular board configuration is described. The method involves, for each pattern class, accessing statistics (see box 77) describing a probability distribution over legal moves in a given board configuration. In a preferred embodiment we use one-dimensional Gaussian distributions to represent urgency belief. By using Gaussian distributions we achieve the advantage that such distributions can be uniquely described by two statistics, the mean and standard deviation, as explained above. In addition, the sum of two Gaussian random variables is itself a Gaussian random variable which enables us to simplify our computations. However, it is not essential to use Gaussian distributions to represent urgency belief.

If a pattern class has been analyzed before using our learning process and we have stored urgency information for that pattern class, that information is accessed. In the case of a new pattern class we use a default urgency belief distribution with associated default statistics, for example an initial mean of 0 and standard deviation of 1. Any suitable default belief distribution is used.

Information about the harvested pattern classes is obtained (see box 70) including an associated board configuration for each harvested pattern class. For a given harvested pattern class (and board configuration) we determine other possible legal moves, each having an associated pattern class (see box 71). Information about the rules of the game is used to determine the other possible legal moves.

We know that the harvested pattern class was played and that the other possible legal moves (here pattern classes) were not played. This information together with the statistics is used to form a factor graph (see box 72). The factor graph comprises nodes associated with particular pattern classes, those nodes being ordered on the basis of which pattern class was played and which pattern classes were not played. Some nodes of the factor graph are instantiated with the accessed statistics information (see box 73). Message passing is then performed over the factor graph to update the statistics thus carrying out Bayesian inference (see box 74). The resulting updated statistics describe our belief of the relative urgencies of the pattern classes and these results are stored (see box 75) for example, in a hash table or other suitable store. This process is repeated (see 76) for further harvested pattern classes.

More detail about the process of forming the factor graph is now given with reference to FIG. 5. The factor graph comprises nodes connected by links. The nodes are either variable nodes (circles) or factor nodes (squares). Variable nodes represent storage locations and factor nodes represent computational units. The factor nodes read and write information from and to their neighboring variable nodes, respectively, according to calculation rules described later.

In FIG. 5 each row of nodes relates to a particular pattern class with the upper most row relating to the pattern class corresponding to the played move and the other rows of nodes relating to pattern classes corresponding to legal but un-played moves for the same board configuration. The factor graph can be drawn in any suitable manner to capture these relationships, for example, using columns for each pattern class rather than rows. As illustrated in FIG. S the factor graph is preferably acyclic. Preferably it comprises two types of nodes, variable nodes and factor nodes, and it is bipartite, i.e, the only permissible type of connection is between a factor node and a variable node.

The factor nodes labeled s1, s2, . . . sn are functions which access a database or other store to obtain belief distributions for each pattern class (or use as a default distribution in the case of new pattern classes). These computational units feed the parameters describing the urgency belief distributions into the corresponding variable nodes. For example, in the case of Gaussian distributions there would be two parameters stored in each variable node. The next column of variable nodes, that is the circular nodes u1, u2 . . . un represent the urgencies of the pattern classes. These nodes each store the statistics describing the belief distribution for the associated pattern class. The next column of factor nodes are computation units g1, g2 . . . gn which compute the distribution corresponding to the effective urgency value in the observed configuration and feed the parameters into the corresponding variable nodes x1, x2 . . . xn. The remaining factor nodes h2, . . . hn encode which pattern class was played. These are order factor nodes which implement an order constraint indicating that the effective urgency value of the move made must have been greater than the effective urgency values of the moves not played. For these nodes the associated update equations are not exact as the true factor-to-variable messages are no longer Gaussian. The other factor nodes of FIG. 5 are exact factor nodes because their associated messages can be computed and represented exactly.

The process of message passing comprises carrying out a calculation associated with a computation node (square node of FIG. 5) using distribution parameters from neighboring variable nodes and passing the results to one of the neighboring variable nodes (circular nodes in FIG. 5). The direction of passing the results (also referred to as a processing schedule) is explained in more detail now with reference to FIG. 6.

The processing schedule is preferably divided into three phases: pre-processing, chain processing and post-processing. An example pre-processing schedule is illustrated by arrows 90 in FIG. 6. Starting at initial factor nodes s1, s2, . . . sn computation proceeds along the rows until nodes x1, x2, . . . xn are reached. The post processing schedule is the reverse of the pre-processing schedule but stopping at the variable nodes u1, u2, . . . un which may then contain the quantity of interest. After pre-processing a processing schedule is iterated until the belief distributions converge or stop changing. An example schedule is indicated in FIG. 6 using dotted arrows. When convergence is reached or substantially reached, then the post processing phase passes the distributions back to the left of the rows to obtain the new urgency statistics. Each arrow in the processing schedule represents a non trivial calculation and details of those calculations are given below.

We present general update equations for use in carrying out the computations along the arrows in the message passing process. We tailor those general update equations for use with Gaussian distributions as shown.

Factor Node Update with Gaussian Messages

Consider the example of factor graph of FIG. 11.

Suppose we would like to update the message m_(ƒ→x) and the marginal distribution p_(x). Then, the general update equations are as follows:

$\begin{matrix} {{{m_{x\rightarrow f}(x)} \propto \frac{p_{x}(x)}{m_{f\rightarrow x}(x)}},} \\ {{{m_{f\rightarrow x}^{true}(x)} \propto {\int{\int{{{f\left( {x,y,z} \right)} \cdot \frac{p_{y}(y)}{m_{f\rightarrow y}(y)} \cdot \frac{p_{z}(z)}{m_{f\rightarrow z}(z)}}{y}{z}}}}},} \\ {{{p_{x}(x)} = {{MM}\left\lbrack {{m_{f\rightarrow x}^{true}(x)}\; {m_{x\rightarrow f}(x)}} \right\rbrack}},} \\ {{{m_{f\rightarrow x}(x)} \propto \frac{p_{x}(x)}{m_{x\rightarrow f}(x)}},} \end{matrix}$

where MM[.] returns the distribution in the Gaussian family with the same moments as the argument and all quantities on the right are normalized to be distributions. In the following we use the exponential representation of the Gaussian, that is,

G(x;τ,π)∝exp(πx²−2τx)

This density has the following relation to the standard density

$\begin{matrix} {{{G\left( {{x;\tau},\pi} \right)}:={N\left( {{x;\frac{\tau}{\pi}},\frac{1}{\pi}} \right)}},} & {or} & {{N\left( {{x;\mu},\sigma^{2}} \right)}:={G\left( {{x;\frac{\mu}{\sigma^{2}}},\frac{1}{\sigma^{2}}} \right)}} \end{matrix}$

In the case of the exact factor nodes the update equations are given in the following table.

Factor Update equation

 Corresponds to FIG. 12 $\left. \pi_{x}^{new}\leftarrow{\pi_{x} + \frac{1}{v^{2}}} \right.$ $\left. \tau_{x}^{new}\leftarrow{\tau_{x} + \frac{m}{v^{2}}} \right.$  This is exact and should only be executed once.

 Corresponds to FIG. 13 π_(f → x)^(new) ← α(π_(y) − π_(f) → y) τ_(f → x)^(new) ← α(τ_(y) − τ_(f) → y) π_(x)^(new) ← π_(x) + π_(f → x)^(new) − π_(f) → x τ_(x)^(new) ← τ_(x) + τ_(f → x)^(new) − τ_(f) → x $\alpha \text{:} = \frac{1}{1 + {c^{2}\left( {\pi_{y} - \pi_{f\rightarrow y}} \right)}}$

 See FIG. 14

 See FIG. 14

In the case of the order factor nodes, the update equations are given in the following table.

Factor Update equation

 Corresponds to FIG. 15 $\left. \pi_{x}^{new}\leftarrow\frac{c}{1 - {w\mspace{11mu} \left( {\frac{d}{\sqrt{c^{2}}}ɛ\sqrt{c}} \right)}} \right.$ $\left. \tau_{x}^{new}\leftarrow\frac{d + {{\sqrt{c} \cdot v}\mspace{11mu} \left( \frac{d}{\sqrt{c^{2}}ɛ\sqrt{c}} \right)}}{1 - {w\mspace{11mu} \left( {\frac{d}{\sqrt{c^{2}}}ɛ\sqrt{c}} \right)}} \right.$ π_(f → x)^(new) ← π_(f → x) + π_(x)^(new) − π_(x) τ_(f → x)^(new) ← τ_(f → x) + τ_(x)^(new) − τ_(x) c = π_(x) − π_(f → x),  d = τ_(x) − τ_(f → x)

In the update equations set out in the tables above a represents weightings which in a preferred example are set to 1. Also, in the update equations v and w correspond to the functions v(.,.) and w(.,.) given by

${v\left( {t,\alpha} \right)} = \frac{N\left( {t - \alpha} \right)}{\Phi \left( {t - \alpha} \right)}$ w(t, α) = v(t, α) ⋅ (v(t, α) − (t − α))

Where the symbols N and Φ represent the density of the Gaussian distribution function and the cumulative distribution function of the Gaussian, respectively. The symbols t and α are simply arguments to the functions. Any suitable numerical or analytic methods can be used to evaluate these functions such as those described in Press et al., Numerical Recipes in C: the Art of Scientific Computing (2d. ed.), Cambridge, Cambridge University Press, ISBN-0-521-43108-5.

In the example shown in FIG. 6 the message passing during the schedule involves order factor node updates from the nodes h to the nodes x using the update equation of the first row of the order factor node update equation table.

In the case of exact factor nodes, for message passing from a computation node (square node) to a single variable node (circular node) the update equations of the first row of the exact factor node update equation table is used. In the case of message passing from a computation node to two variable nodes the update equations of the second or third row of the table are used as appropriate.

In other embodiments we learn a play probability (probability of being played given a particular board configuration) for each pattern class. This is now described with reference with FIG. 9. Information about a harvested pattern class and its associated board configuration is accessed (see box 100). A first counter is then incremented to indicate that this pattern class has been played (see box 101). We determine (using information about the rules of the game) other potential legal moves for the particular board configuration. These potential legal moves were not played. We identify the associated pattern classes for these potential legal moves (see box 102). Second counters are then incremented for each pattern class that could have been played but was not played (see box 103). If all harvested pattern classes have been processed (see box 104) then we proceed to estimate a probability of being played for each pattern class (see box 105). If there are more harvested patterns to process then we repeat the earlier method (see 106 in FIG. 9). The estimate of the probability of being played is made on the basis of the first and second counters (see box 105). The estimates are stored in any suitable manner. A particular example of this method is described in detail below under the heading Independent Bernoulli Model.

Using the Learnt Information to Play Games

Once the learning phase has been completed to learn from the harvested patterns we are able to use the results to select a move or rank possible moves, given a particular board configuration. This is now described with reference to FIG. 8. In some embodiments we learn urgency belief statistics and in other embodiments we learn estimates of probabilities of play. All embodiments involve learning belief distributions.

At a high level, we access the current board configuration, and for each possible board location where the next move could be played (all legal potential play positions) we find any harvested patterns which match. Any suitable pattern matching technique is used. For example, we can search for exact matches only, or allow inexact matches within specified bounds. We then select one of the matched pattern classes on the basis of the learnt urgency belief or play probability information. In a preferred embodiment we carry out the pattern matching process in an order on the basis of the size of the pattern templates. This is not essential but it enables us to give preference to patterns of larger size. It would also be possible to give preference to patterns of a specified size range or patterns having particular characteristics. One could also combine patterns of different sizes.

As shown in FIG. 8 we access the current board configuration (see box 80). This is achieved in any suitable manner via a user interface, or other interface to our automated game system. For each possible board grid location where the next stone could be played (all legal potential play positions) we try to match the largest pattern template in the current board configuration. This is done in any suitable manner. For example, for pattern template 14 there might be no harvested pattern classes which match the current board configuration. We then try the next smallest pattern template (see FIG. 8). This continues until we find a pattern template which has one or more harvested pattern classes which match regions of the current board configuration. We select one of the matched pattern classes for each possible play position in any suitable manner (although there may be some play positions which have no matches). The selection can be arbitrary or on the basis of the learnt information for example. We access the learnt information for the selected matched pattern class. For example, if the learnt information is stored using a hash table, we calculate a hash key for the matched pattern class (see box 82) and then look up the learnt belief distributions (see box 83). We then select (see box 84) one of the matched pattern classes on the basis of the learnt information. The automated system is then able to play the next move of the game on the basis of the selected pattern class (see box 85) and the board configuration is updated (see box 86).

As mentioned above, the learnt information can be used for other purposes besides creating an automated player of a game. For example, the learnt information can be used in study or training tools for those seeking to improve their game playing skills. It can also be provided as input to automated game playing systems which use other approaches such as tree search or Monte Carlo game playing systems.

FIG. 10 is a schematic diagram of a game engine 110 as part of a system for playing a game. The game engine comprises a user interface 111 of any suitable type such as a graphical user interface arranged to be displayed on a display screen with an associated keyboard or other user input means. Information about the game rules 112 is either stored at the game engine or accessible to the game engine from another entity. A processor 119 is also provided which can be a personal computer, a games console or a computer of any suitable type with software to support and enable the game engine to operate. The game engine is provided as a software application on the personal computer or as dedicated hardware or in any suitable manner as known in the art.

The game engine 110 has an input arranged to receive a current board configuration 113. For example, this can be via the user interface or input received as an email, flat file or any other suitable medium. The game engine 110 also has access to learnt probability information 11 S for harvested pattern classes 117 obtained from historical game records 116. The learnt probability information is stored in any suitable manner either integral with the game engine or at another entity in communication with the game engine.

The game engine provides ranked possible next moves 114 as output or one selected next move for play. It can also provide a list of legal moves with associated urgency statistics or probability of play. Optionally the system also comprises a tree search, Monte Carlo game system 118 or other game system which uses techniques different to that of the game engine itself. The learnt probability information 115 and/or the ranked possible next moves 114 are used by that optional game system 118 to tailor or focus the processing of that system.

A preferred embodiment involving urgencies is now described:

Bayesian Pattern Ranking Model

We now present an example model of the probability P({right arrow over (υ)}|c) of an expert Go player making a move (at vertex) {right arrow over (υ)} ε ζ in board configuration c. We only consider legal moves {right arrow over (υ)} ε L(c), where L(c)⊂ ζ is the set of legal moves in configuration c.

A move at {right arrow over (υ)} in configuration c is represented by the largest pattern class {tilde over (π)}_(max)({right arrow over (υ)},c)ε Π that matches c at v. In our Bayesian model, we use a Gaussian belief p(u)=N(u;μ,diag(σ²)) over urgencies u({tilde over (π)}) of pattern classes {tilde over (π)}. Then the predictive distribution is given by P({right arrow over (υ)}|c)=∫P({right arrow over (υ)}|c,u)p(u)du. Our likelihood model P({right arrow over (υ)}|c,u)is defined via the notion of a latent, unobserved urgency x({tilde over (π)}) for each pattern class, where p(x|u)=N(x:u,β²) is also assumed to be Gaussian with mean u and a fixed variance β²; the value of β expresses the variability of the urgency depending on specific position and player characteristics. In this sense, β can also be related to the consistency of play and can be chosen smaller for stronger players. We assume that an expert makes the move with the highest effective urgency value, hence,

$\begin{matrix} {{P\left( {{v\text{|}c},u} \right)}:={{P\begin{pmatrix} {\; {{\arg \; \max \left\{ {x\left( {{\overset{\sim}{\pi}}_{\max}\left( {{\overset{\rightarrow}{v}}^{\prime},c} \right)} \right)} \right\}} = \overset{\rightarrow}{v}}} \\ {{\overset{\sim}{v}}^{\prime} \in {L(c)}} \end{pmatrix}}.}} & (1) \end{matrix}$

This model can be expressed as a factor graph of the type shown in FIG. 5. The probability (1) can be efficiently calculated by Expectation Propagation (EP) message passing in factor graphs.

Learning and Inference

A goal of learning is to determine the parameters μ and σ² of the belief distribution p(u)=N(u;μ,diag(σ²)) from training data. The Bayesian posterior is given by

${p\left( {{u\text{|}\overset{\rightarrow}{v}},c} \right)} = {\frac{{P\left( {{\overset{\rightarrow}{v}\text{|}c},u} \right)}{p(u)}}{P\left( {\overset{\rightarrow}{v}\text{|}c} \right)}.}$

In general, this posterior is no longer a Gaussian and has non-zero covariance. We use a local assumed density filtering to approach where we seek the best (diagonal) Gaussian approximation q(u|{right arrow over (υ)},c) to the posterior P(u|{right arrow over (υ)},c) in the sense of minimum Kullback-Leibler divergence when leaving out one factor from P({right arrow over (υ)}|c,u). Once a move at vertex {right arrow over (υ)} at configuration c has been incorporated into the prior p(u), the posterior p(u|{right arrow over (υ)},c) is based as the prior for the next expert move at the new board configuration. Again inference can be performed efficiently using EP message passing.

The factor graph (see FIG. 5) expresses the joint distribution p({right arrow over (υ)},u,x|c):

${{p\left( {\overset{\rightarrow}{v},u,{x\text{|}c}} \right)} = {\prod\limits_{i = 1}^{n}{{s_{i}\left( u_{i} \right)}{\prod\limits_{j = 1}^{n}{{g_{j}\left( {x_{j},u_{j}} \right)}{\prod\limits_{k = 2}^{n}{h_{k}\left( {x_{1},x_{k}} \right)}}}}}}},$

where

s _(i)(u _(j))=N(u _(i);μ_(i),σ_(i) ²),

g _(j)(x _(j) ,u _(j))−N(x _(j) ;u _(j)β²),

h _(k)(x _(i) ,x _(k))=Π(x _(l) >x _(k)).

We are interested in determining the marginals p(u_(i)) of the joint distribution defined above. This can be accomplished by a sum-product algorithm. Examples of such an algorithm are given in Jordan & Weiss, 2002 Graphical models: probabilistic inference”. In M. Arbib (Ed.), Handbook of neural networks and brain theory. MIT Press. 2^(nd) edition.

For any variable, υ_(i), connected to its neighboring factors, ƒ_(k) ε neigh(υ_(i)), the marginal distribution of υ_(i) is given by

$\begin{matrix} {{p\left( v_{i} \right)} = {\prod\limits_{f_{k} \in {{neigh}{(v_{i})}}}{m_{{fk}\rightarrow v_{i}}\left( v_{i} \right)}}} & (2) \end{matrix}$

where m_(ƒ) _(k) _(→υ) _(o) (υ_(i)) denotes a ‘message’ function passing from factor ƒ_(k) to variable υ_(i). Messages are calculated as follows to perform exact inference on a factor tree. For notational convenience, we only state the factor-to-variable message equation for the first variable, v_(o).

$\begin{matrix} {{{m_{f_{k}\rightarrow v_{o}}\left( v_{o} \right)} = {\int{{f_{k}\left( \left\lbrack {v_{o};v} \right\rbrack \right)}{\prod\limits_{j = 1}^{n}{{m_{v_{j}\rightarrow f_{k}}\left( v_{j} \right)}{v}}}}}},} & (3) \\ {{m_{v_{i}\rightarrow f_{k}}\left( v_{i} \right)} = {\prod\limits_{j \in {{{neigh}{(v_{i})}}\backslash {\{ f_{k}\}}}}{{m_{f_{k}\rightarrow v_{j}}\left( v_{j} \right)}.}}} & (4) \end{matrix}$

These equations derive from the fact that we can make use of the conditional independence structure of the joint distribution to rearrange the marginalization integral and thus simplify it.

We make the approximation that all messages are Gaussian densities to reduce storage requirements (messages can be represented by two numbers) and to simplify the calculations. For factors ƒ_(k) of general form, the factor-to-variable message calculated by (3) are not necessarily Gaussian. Therefore we approximate these messages by a Gaussian which minimizes the Kullback-Leibler divergence between the marginal distribution, p(υ_(i))=m_(ƒ) _(k) _(→υ) _(i) (υ_(i))·m_(υ) _(i) _(→ƒ) _(k) (υ_(i)), and its Gaussian approximation, q(υ_(i))={circumflex over (m)}_(ƒ) _(k) _(→υ) _(i) (υ_(i)), where {circumflex over (m)}_(ƒ) _(k) _(→υ) _(i) (υ_(i)) is the approximate (Gaussian) message from factor ƒ_(k) to variable υ_(i). That is,

$\begin{matrix} {{{\hat{m}}_{f_{k}\rightarrow v_{i}}\left( v_{i} \right)} = \frac{{MM}\left\lfloor {{m_{f_{k}\rightarrow v_{i}}\left( v_{i} \right)} \cdot {m_{v_{i}\rightarrow f_{k}}\left( v_{i} \right)}} \right\rfloor}{m_{v_{i}\rightarrow f_{k}}\left( v_{i} \right)}} & (5) \end{matrix}$

where MM demotes ‘Moment Match’.

The goal of learning is to determine (from training data) the parameters μ_(i) and σ_(i) ² of the belief distribution p(u_(i))=N(u_(i);μ_(i),σ_(i) ²) for the value of each pattern. We calculate the posterior p(u|{right arrow over (υ)},c) by first propagating messages about the graph according to (3), (4) and (5) until convergence. The approximate posterior distributions we require are

p(u _(i))=m ₈ _(i) _(→u) _(i) (u _(i))·m _(g) _(i) _(→u) _(i) (u _(i))   (6)

Once a move at vertex {right arrow over (υ)} at configuration c has been incorporated into the prior p(u), the posterior p(u→{right arrow over (υ)}i,c) is used as the prior for the next expert move at the new board configuration. This approach is a form of assumed-density filtering.

Independent Bernoulli Model

We also consider an alternative approach where we assume that each pattern class is played independently of the other available pattern classes with probability p_({right arrow over (υ)},c):=p({tilde over (π)}_(max)({right arrow over (υ)},c)) (the probability of the maximal pattern class matched at vertex {right arrow over (υ)} in configuration c). The probability of a move at location {right arrow over (υ)} in position c given the pattern probabilities, p, is

${p\left( {{\overset{\rightarrow}{v}\text{|}c},p} \right)} = {p_{\overset{\rightarrow}{v},c} \cdot {\prod\limits_{{\overset{->}{v}}^{\prime} \in {{L{(c)}}\backslash \overset{\rightarrow}{v}}}{\left( {1 - p_{{\overset{\rightarrow}{v}}^{\prime},c}} \right).}}}$

Our uncertainty on the p_({right arrow over (υ)},c) is modeled by a conjugate Beta prior p(p_({right arrow over (υ)},c))=Beta(p_({right arrow over (υ)},c);α_({right arrow over (υ)},c),β_({right arrow over (υ)},c)) so the marginal probability of a move P({right arrow over (υ)}|c,α,β) is

${{\int{{p\left( {{\overset{\rightarrow}{v}\text{|}c},p} \right)}{\prod\limits_{{\overset{->}{v}}^{\prime} \in {L{(c)}}}{{{Beta}\left( {{p_{{\overset{\rightarrow}{v}}^{\prime},c};\alpha_{{\overset{\rightarrow}{v}}^{\prime},c}},\beta_{{\overset{\rightarrow}{v}}^{\prime}},c} \right)}{p}}}}} = {\frac{\alpha_{\overset{\rightarrow}{v},c}}{\alpha_{\overset{\rightarrow}{v},c} + \beta_{\overset{\rightarrow}{v},c}} \cdot {\prod\limits_{{\overset{->}{v}}^{\prime} \in {{L{(c)}}\backslash \overset{\rightarrow}{v}}}\left( {1 - \frac{\alpha_{{\overset{\rightarrow}{v}}^{\prime},c}}{\alpha_{{\overset{\rightarrow}{v}}^{\prime},c} + \beta_{{\overset{\rightarrow}{v}}^{\prime},c}}} \right)}}},$

where α_({right arrow over (υ)},c) corresponds to the number of times this pattern class {tilde over (π)}_(max)({right arrow over (υ)},c) matched for a move played by an expert in the training data and β_({right arrow over (υ)},c) corresponds to number of times the pattern class matched {tilde over (π)}_(max)({right arrow over (υ)},c) for moves that were available but not chosen.

Those skilled in the art will realize that storage devices utilized to store program instructions can be distributed across a network. For example, a remote computer may store an example of the process described as software. A local or terminal computer may access the remote computer and download a part or all of the software to run the program. Alternatively, the local computer may download pieces of the software as needed, or execute some software instructions at the local terminal and some at the remote computer (or computer network). Those skilled in the art will also realize that by utilizing conventional techniques known to those skilled in the art that all, or a portion of the software instructions may be carried out by a dedicated circuit, such as a DSP, programmable logic array, or the like.

Any range or device value given herein may be extended or altered without losing the effect sought, as will be apparent to the skilled person.

The steps of the methods described herein may be carried out in any suitable order, or simultaneously where appropriate.

It will be understood that the above description of preferred embodiments are given by way of example only and that various modifications may be made by those skilled in the art. For example, the embodiments are described with reference to the game of GO and are also applicable to other games such as Chess, Connect6, Gomoku, Renju, Pente, Philosopher's Football, Connection games such as Hex, TwixT, Y, Havannah and *Star; The game of the Amazons, Janggi, Shogi, Xiangqi, Abalone, Alak, and Reversi (also known as Othello (trade mark)). The above specification, examples and data provide a complete description of the structure and use of exemplary embodiments of the invention. Although various embodiments of the invention have been described above with a certain degree of particularity, or with reference to one or more individual embodiments, those skilled in the art could make numerous alterations to the disclosed embodiments without departing from the spirit or scope of this invention. 

1. A method of learning a belief distribution for each of a plurality of patterns, each pattern corresponding to a move in a game, the method comprising: (i) accessing historical game records comprising sequences of moves; (ii) extracting one or more patterns for each move and selecting some of those patterns and discarding others of those patterns; (iii) for each of the selected patterns determining patterns corresponding to alternative moves which could have been played; (iv) learning a belief distribution over a value of each of the selected patterns on the basis of at least information about the patterns corresponding to alternative moves which could have been played.
 2. A method as claimed in claim 1 wherein the patterns are extracted from the historical game records on the basis of one or more pattern templates.
 3. A method as claimed in claim 2 wherein a plurality of nested pattern templates are used having specified symmetric properties.
 4. A method as claimed in claim 1 wherein a belief distribution is learnt for each of a plurality of pattern classes, a pattern class comprising at least a plurality of symmetrically and rotationally equivalent patterns.
 5. A method as claimed in claim 1 wherein the extracted patterns are selected or discarded in a harvesting process on the basis of frequency of occurrence.
 6. A method as claimed in claim S wherein the extracted patterns are selected or discarded in a harvesting process using a spectral Bloom filter.
 7. A method as claimed in claim 1 wherein the step of extracting patterns further comprises identifying one or more local pattern features associated with those patterns using pre specified criteria.
 8. A method as claimed in claim 7 which further comprises mapping each local pattern feature to a binary value.
 9. A method as claimed in claim 1 wherein the belief distribution over the value of a pattern is obtained on the basis that each pattern is played independently of the other patterns corresponding to alternative moves that could have been played.
 10. A method as claimed in claim 1 wherein the learnt belief distribution over the value of a pattern is obtained on the basis of a number of times a pastern occurs in the selected patterns relative to a number of times that pattern could have been played.
 11. A method as claimed in claim 1 wherein the step of learning a belief distribution comprises using Bayesian inference.
 12. A method as claimed in claim 1 which further comprises for each selected pattern: accessing statistics describing a probability distribution associated with belief about an urgency of a move relating to that pattern; forming a factor graph comprising nodes, said graph being formed on the basis of the selected pattern and its associated patterns corresponding to alternative moves which could have been played; instantiating at least some of the nodes with the statistics; updating the statistics associated with each selected pattern by using message passing techniques over the factor graph.
 13. A computer-readable medium having computer-executable instructions for performing a computer process implementing the method of claim
 1. 14. A method of selecting a game move having an associated pattern from a plurality of potential game moves having associated patterns, the method comprising: (i) accessing harvested patterns corresponding to historical game moves and also accessing a learnt belief distribution for each harvested pattern; (ii) for each potential game moves, identifying one or more of the harvested patterns that substantially matches the pattern associated with the potential game move; (iii) selecting one of the potential game moves on the basis of the learnt belief distributions of the substantially matched patterns.
 15. A method as claimed in claim 14 wherein the learnt belief distributions are obtained using a method as claimed in claim
 1. 16. A method as claimed in claim 14 wherein the step (ii) of identifying one or more of the harvested patterns comprises a pattern matching process that is arranged to give priority to patterns on the basis of pattern size.
 17. A method as claimed in claim 14 which further comprises providing a plurality of selected potential game moves to a tree search system such that a focused tree search can be carried out relating to a game.
 18. A method as claimed in claim 14 which further comprises providing a plurality of selected potential game moves to a Monte Carlo system such that a focused Monte Carlo search can be carried out relating to a game.
 19. A computer-readable medium having computer-executable instructions for performing a computer process implementing the method of claim
 14. 20. An apparatus for automatically playing a game comprising: (i) a user interface arranged to receive a game configuration; (ii) a game engine having access to rules of the game and arranged to automatically determine a plurality of potential game moves and associated patterns from the game configuration; (iii) an interface to a harvested pattern store arranged to access information about harvested patterns corresponding to historical game moves and also arranged to access learnt belief distributions for each harvested pattern; (iv) a processor arranged to, for each potential game move, identify one or more of the harvested patterns that substantially matches the pattern associated with that potential game move; and (v) a selector, arranged to select one of the potential game moves on the basis of the learnt belief distributions of the substantially matched patterns. 